import { Column, Entity, PrimaryColumn } from 'typeorm';

@Entity()
export class Oauth2Authorization {
  @PrimaryColumn({ type: 'varchar', length: 100 })
  id: string;

  @PrimaryColumn({
    type: 'varchar',
    length: 100,
    name: 'registered_client_id'
  })
  registeredClientId: string;

  @Column({
    type: 'varchar',
    length: 200,
    name: 'principal_name'
  })
  principalName: string;

  @Column({
    type: 'varchar',
    length: 100,
    name: 'authorization_grant_type'
  })
  authorizationGrantType: string;

  @Column({
    type: 'varchar',
    length: 1000,
    name: 'authorized_scopes'
  })
  authorizedScopes: string;

  @Column({
    type: 'blob',
    default: null
  })
  attributes: unknown;

  @Column({
    type: 'varchar',
    length: 500,
    default: null
  })
  state: string;

  @Column({
    type: 'blob',
    default: null,
    name: 'authorization_code_value'
  })
  authorizationCodeValue: unknown;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'authorization_code_issued_at'
  })
  authorizationCodeIssuedAt: Date;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'authorization_code_expires_at'
  })
  authorizationCodeExpiresAt: Date;

  @Column({
    type: 'blob',
    default: null,
    name: 'authorization_code_metadata'
  })
  authorizationCodeMetadata: unknown;

  @Column({
    type: 'blob',
    default: null,
    name: 'access_token_value'
  })
  accessTokenValue: unknown;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'access_token_issued_at'
  })
  accessTokenIssuedAt: Date;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'access_token_expires_at'
  })
  accessTokenExpiresAt: Date;

  @Column({
    type: 'blob',
    default: null,
    name: 'access_token_metadata'
  })
  accessTokenMetadata: unknown;

  @Column({
    type: 'varchar',
    length: 100,
    default: null,
    name: 'access_token_type'
  })
  accessTokenType: string;

  @Column({
    type: 'varchar',
    length: 1000,
    default: null,
    name: 'access_token_scopes'
  })
  accessTokenScopes: string;

  @Column({
    type: 'blob',
    default: null,
    name: 'oidc_id_token_value'
  })
  oidcIdTokenValue: unknown;

  @Column({
    type: 'blob',
    default: null,
    name: 'oidc_id_token_metadata'
  })
  oidcIdTokenMetadata: unknown;

  @Column({
    type: 'blob',
    default: null,
    name: 'refresh_token_value'
  })
  refreshTokenValue: unknown;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'oidc_id_token_issued_at'
  })
  oidcIdTokenIssuedAt: Date;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'oidc_id_token_expires_at'
  })
  oidcIdTokenExpiresAt: Date;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'refresh_token_issued_at'
  })
  refreshTokenIssuedAt: Date;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'refresh_token_expires_at'
  })
  refreshTokenExpiresAt: Date;

  @Column({
    type: 'blob',
    default: null,
    name: 'user_code_value'
  })
  userCodeValue: unknown;

  @Column({
    type: 'blob',
    default: null,
    name: 'refresh_token_metadata'
  })
  refreshTokenMetadata: unknown;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'user_code_issued_at'
  })
  userCodIssuedAt: Date;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'user_code_expires_at'
  })
  userCodeExpiresAt: Date;

  @Column({
    type: 'blob',
    default: null,
    name: 'user_code_metadata'
  })
  userCodeMetadata: unknown;

  @Column({
    type: 'blob',
    default: null,
    name: 'device_code_value'
  })
  deviceCodeValue: unknown;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'device_code_issued_at'
  })
  deviceCodeIssuedAt: Date;

  @Column({
    type: 'timestamp',
    default: null,
    name: 'device_code_expires_at'
  })
  deviceCodeExpiresAt: Date;

  @Column({
    type: 'blob',
    default: null,
    name: 'device_code_metadata'
  })
  deviceCodeMetadata: unknown;
}
